package mips.instructions;

import mips.structure.MipsInstr;
import mips.value.MipsValue;
import mips.value.Register;

public class Sw extends MipsInstr {
    private MipsValue src;
    private MipsValue dest;

    public Sw(MipsValue src, MipsValue dest) {
        this.src = src;
        this.dest = dest;
    }

    @Override
    public String toString() {
        if (src.equals(dest)) {
            return "";
        }
        if (src instanceof Register && dest instanceof Register) {
            return "sw " + src + ", 0(" + dest + ")";
        }
        return "sw " + src + ", " + dest;
    }

}
